//
//  SLDBAccess.h
//  SLAdingo
//
//  Created by 徐 廷 on 10/04/01.
//  Copyright 2010 adingo Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>

enum {
    fileNotExist		= ' fne',
    openFailed			= 'opfl',
    closeFailed			= 'clfl',
    copyFailed          = 'cpfl'
};

@interface SLDBAccess : NSObject {
    NSString        *dbPath;
    sqlite3         *database;
    BOOL            connected;
}

@property (nonatomic, readonly) sqlite3 *database;
@property (nonatomic, assign) BOOL      connected;

+ (SLDBAccess *) sharedSLDBAccess;

- (OSStatus) initImmutableDBWith: (NSString*) DBFileName;
- (OSStatus) initMutableDBWith: (NSString*) DBFileName;

- (OSStatus) connectDB;
- (OSStatus) closeDB;


#pragma mark -
#pragma mark DB Common
+ (NSString *) getSafeNSStringFromCString:(const void *)buffer;
+ (NSData *) getSafeDataFrom:(const void *)bytes length:(NSUInteger)length;

@end
